function DruidG1zStar3() -- TODO: @Develop

	if not ThrottleFrame then _ThrottleFrame() end

	if ccrValidTarget() and not IsMounted() and GetShapeshiftForm() ~= 1 then CastShapeshiftForm(1) return end
	if ccrValidTarget() and not ccrPIIC() and SIR("Enrage") then ccrCast("Enrage") return end

	if ccrValidTarget() and ccrPIIC() then
		
		if ccRS.G1zStarInterrupt then TauntTrainer() end
	
		if useCDS and SIR("Berserking") then ccrCast("Berserking") end
		if useCDS and SIR("Lifeblood") then ccrCast("Lifeblood") end
		
		if SIR("Barkskin") then ccrCast("Barkskin") end
		
		if (ccRS.Auto_AoE or ccRS.Manual_AoE) and GTargetCount(8) > 1 then
			if SCA("Thrash") and not ccrTargetHasMyDebuff("Thrash") then ccrCastAttack("Thrash") return end
			if SCA("Mangle") then ccrCastAttack("Mangle") return end
			if SCA("Swipe") then ccrCastAttack("Swipe") return end
		end
		
		if (ccrTargetHasDebuffRemaining("Weakened Blows", 3) or not ccrTargetHasDebuff("Weakened Blows", any)) and SCA("Thrash") then ccrCastAttack("Thrash") return end
		if ccrPHB("Tooth and Claw") and ccrRage() >= 90 and SCA("Maul") then ccrCastAttack("Maul") return end
		if SCA("Lacerate") and (ccrTargetHasMyDebuffRemaining("Lacerate",3) or (not ccrTargetHasMyDebuffStacks("Lacerate", 3) and not ccrTargetHasDebuffRemaining("Weakened Blows", 3)) or ccrPHB("Berserk")) then ccrCastAttack("Lacerate") return end
		if not ccrTargetHasDebuffStacks("Weakened Armor", 3, any) and SIR("Faerie Fire") then ccrCast("Faerie Fire") return end
		if ccrTargetHasMyDebuffRemaining("Thrash", 3) and ccrPHB("Berserk") and SCA("Thrash") then ccrCastAttack("Thrash") return end
		if SCA("Mangle") then ccrCastAttack("Mangle") return end
		if SpellCDDuration("Mangle") > 0 and SpellCDDuration("Mangle") <= 0.5 then return end
		if SIR("Cenarion Ward") then ccrCast("Cenarion Ward", "player") return end
		if ccrTargetHasMyDebuffRemaining("Lacerate", 3) or not ccrTargetHasMyDebuffStacks("Lacerate", 3) and SCA("Lacerate") then ccrCastAttack("Lacerate") return end
		if SCA("Thrash") and ccrTargetHasMyDebuffRemaining("Thrash", 2) then ccrCastAttack("Thrash") return end
		if SCA("Lacerate") then ccrCastAttack("Lacerate") return end
		if SIR("Faerie Fire") and not ccrTargetHasMyDebuffRemaining("Thrash", 6) then ccrCast("Faerie Fire") return end
		if SCA("Thrash") then ccrCastAttack("Thrash") return end
	end
end

function DruidG1zStar2() -- TODO: @Change to Advanced Rotation

	if not ThrottleFrame then _ThrottleFrame() end

	-- if not ripframe then
	
	-- 	ripframe = CreateFrame("Frame", "ripframe", UIParent)
	-- 	ripframe:RegisterEvent("COMBAT_LOG_EVENT")
	-- end

	if ccrValidTarget() then
		if not _G[Target.GUID.."_ripcurdmg"] then _G[Target.GUID.."_ripcurdmg"] = 0 end
		if not _G[Target.GUID.."_rakecurdmg"] then _G[Target.GUID.."_rakecurdmg"] = 0 end
	end

	if ccrValidTarget() and not ccrPIIC() and GetShapeshiftForm() ~= 3 then CastShapeshiftForm(3) return end
	if ccrValidTarget() and not ccrPIIC() and GetShapeshiftForm() == 3 and not ccrPHB("Savage Roar") then ccrCast("Savage Roar") return end
	if ccrPIIC() and ccrValidTarget() then

		if ccRS.G1zStarInterrupt then InterrupTrainer() end

		if GetShapeshiftForm() ~= 3 then CastShapeshiftForm(3) return end

		local _, energyregen = GetPowerRegen()

		if (ccRS.Auto_AoE or ccRS.Manual_AoE) and GPlayerCount(8) >= 5 then
			if SCA("Faerie Fire") and not ccrTargetHasDebuffStacks("Weakened Armor", 3, any) then ccrCastAttack("Faerie Fire") return end
			if SIR("Faerie Fire") then FaerieFireCheck() end
			if not ccrPHB("Savage Roar") or (ccrPHBR("Savage Roar", 3) and ccrPoints() > 0) then ccrCast("Savage Roar") return end
			if not ccrPHB("Omen of Clarity") and ccrEnergy() <= 35 and SIR("Tiger's Fury") then ccrCast("Tiger's Fury") return end
			if ccrPHB("Tiger's Fury") and useCDS and SIR("Lifeblood") then ccrCast("Lifeblood") return end
			if ccrPHB("Tiger's Fury") and useCDS and SIR("Berserking") then ccrCast("Berserking") return end
			if ccrPHB("Tiger's Fury") and useCDS and SIR("Berserk") then ccrCast("Berserk") return end
			if ccrPHB("Rune of Re-Origination") and not onCD("Thrash") and ccrInRange("Thrash","target") and select(2, IsUsableSpell("Thrash")) then return end
			if SCA("Thrash") then ccrCastAttack("Thrash") return end
			if SCA("Thrash") and ((ccrTargetHasMyDebuffRemaining("Thrash", 3) or not ccrTargetHasMyDebuff("Thrash")) or (ccrPHB("Tiger's Fury") and ccrTargetHasMyDebuffRemaining("Thrash", 9))) then ccrCastAttack("Thrash") return end
			if ccrPoints() == 5 and ccrPHBR("Savage Roar", 9) then ccrCast("Savage Roar") return end
			if SCA("Rip") and ccrPoints() == 5 then ccrCastAttack("Rip") return end
			if SCA("Swipe") and ccrPHBR("Savage Roar", 5) then ccrCastAttack("Swipe") return end
			if SCA("Swipe") and (ccrPHB("Berserk" or ccrPHB("Tiger's Fury"))) then ccrCastAttack("Swipe") return end
			if SCA("Swipe") and SpellCDDuration("Tiger's Fury") > 0 and SpellCDDuration("Tiger's Fury") < 3 then ccrCastAttack("Swipe") return end
			if SCA("Swipe") and ccrPHB("Omen of Clarity") then ccrCastAttack("Swipe") return end
			if SCA("Swipe") and (((100 - UnitPower("player")) / energyregen) <= 1.0) then ccrCastAttack("Swipe") return end
		end

		if useCDS and SIR("Berserking") then ccrCast("Berserking") return end

		-- ravage,if=buff.stealthed.up

		if SCA("Ferocious Bite") and ccrTargetHasMyDebuff("Rip") and ccrTargetHasMyDebuffRemaining("Rip", 3) and ccrTargetHealth() <= 25 then ccrCastAttack("Ferocious Bite") return end
		if SCA("Faerie Fire") and not ccrTargetHasDebuffStacks("Weakened Armor", 3, any) then ccrCastAttack("Faerie Fire") return end
		if ccrPlayerHasTalent("Dream of Cenarius") and ccrPHB("Predatory Swiftness") and not ccrPHB("Dream of Cenarius") and SIR("Healing Touch") and (ccrPHBR("Predatory Swiftness", 1.5) or ccrPoints() >= 4) then ccrCast("Healing Touch", "player") return end
		if SIR("Savage Roar") and not ccrPHB("Savage Roar") then ccrCast("Savage Roar") return end
		if SIR("Tiger's Fury") and ccrEnergy() <= 35 and not ccrPHB("Omen of Clarity") then ccrCast("Tiger's Fury") return end
		if useCDS and SIR("Berserk") and (ccrPHB("Tiger's Fury") or (--[[(type(ttd) == "number" and ttd < 18)--]](TTD[Target.GUID] and TTD[Target.GUID] < 18) or SpellCDDuration("Tiger's Fury") > 6)) then ccrCast("Berserk") return end -- ttd disabled
		if useCDS and ccrPHB("Tiger's Fury") and SIR("Lifeblood") then ccrCast("Lifeblood") return end
		
		if SCA("Rip") and ccrPoints() == 5 and ccrTargetHealth() <= 25 and ((currip() / 1.15) > _G[UnitGUID("target").."_ripcurdmg"]) then ccrCastAttack("Rip") return end
		if SCA("Ferocious Bite") and ccrPoints() == 5 and ccrTargetHealth() <= 25 and ccrTargetHasMyDebuff("Rip") then ccrCastAttack("Ferocious Bite") return end
		if SCA("Rip") and ccrPoints() == 5 and (ccrTargetHasMyDebuffRemaining("Rip", 2) or not ccrTargetHasMyDebuff("Rip")) then ccrCastAttack("Rip") return end
		if SCA("Thrash") and ccrPHB("Omen of Clarity") and (ccrTargetHasMyDebuffRemaining("Thrash", 3) or not ccrTargetHasMyDebuff("Thrash")) then ccrCastAttack("Thrash") return end
		-- add check
		-- feralDotNearbyTarget()
		if SCA("Rake") and ((ccrTargetHasBuffRemaining("Rake", 3) or not ccrTargetHasMyDebuff("Rake")) or (currake() > rakecurdmg())) then ccrCastAttack("Rake") return end
		-- add check
		if (ccrTargetHasMyDebuffRemaining("Thrash", 3) or not ccrTargetHasMyDebuff("Thrash")) and (ccrPHB("Berserk") or ccrPoints() == 5 or (not ccrPHBR("Savage Roar",12) and not ccrTargetHasMyDebuffRemaining("Rip",8))) then
			if select(2, IsUsableSpell("Thrash")) and ccrInRange("Thrash","target") then return end
		end
		if SCA("Thrash") and ((ccrTargetHasMyDebuffRemaining("Thrash", 3) or not ccrTargetHasMyDebuff("Thrash")) and (ccrPHB("Berserk") or ccrPoints() == 5 or (not ccrPHBR("Savage Roar", 12) and not ccrTargetHasMyDebuffRemaining("Rip", 8)))) then ccrCastAttack("Thrash") return end
		if ccrPoints() == 5 and not (((100-UnitPower("player"))/energyregen) <= 1 or (ccrPHB("Berserk") and ccrEnergy() >= 25)) and ccrTargetHasMyDebuff("Rip") then return end
		-- if ccrPoints() == 5 and (not (ccrPHB("Berserk") and ccrEnergy() >= 25) or not ((100-UnitPower("player"))/energyregen) <= 1) and ccrTargetHasMyDebuff("Rip") then return end
		if SCA("Ferocious Bite") and ccrPoints() == 5 and ccrTargetHasMyDebuff("Rip") then ccrCastAttack("Ferocious Bite") return end
		if ccrPHB("Omen of Clarity") then
			if SCA("Ravage") and ccrPHB("Prowl") and ccrPlayerIsBehindTarget() then ccrCastAttack("Ravage") return end
			if SCA("Rake") and ((currake()*(raketicksremaining()+1)-rakecurdmg()*raketicksremaining()) > mangledmg()) then ccrCastAttack("Rake") return end
			if SCA("Shred") and ((ccrPlayerIsBehindTarget() and (ccrPHB("Omen of Clarity") or energyregen >= 15)) or ccrPHB("Berserk")) then ccrCastAttack("Shred") return end
			if SCA("Mangle") then ccrCastAttack("Mangle") return end
		end
		if (ccrPoints() < 5 and ccrTargetHasMyDebuffRemaining("Rip", 3)) or (ccrPoints() == 0 and ccrPHBR("Savage Roar", 2)) then 
			if SCA("Ravage") and ccrPHB("Prowl") and ccrPlayerIsBehindTarget() then ccrCastAttack("Ravage") return end
			if SCA("Rake") and ((currake()*(raketicksremaining()+1)-rakecurdmg()*raketicksremaining()) > mangledmg()) then ccrCastAttack("Rake") return end
			if SCA("Shred") and ((ccrPlayerIsBehindTarget() and (ccrPHB("Omen of Clarity") or energyregen >= 15)) or ccrPHB("Berserk")) then ccrCastAttack("Shred") return end
			if SCA("Mangle") then ccrCastAttack("Mangle") return end			
		end
		if ccrPHB("Berserk") or ccrPHB("Tiger's Fury") then
			if SCA("Ravage") and ccrPHB("Prowl") and ccrPlayerIsBehindTarget() then ccrCastAttack("Ravage") return end
			if SCA("Rake") and ((currake()*(raketicksremaining()+1)-rakecurdmg()*raketicksremaining()) > mangledmg()) then ccrCastAttack("Rake") return end
			if SCA("Shred") and ((ccrPlayerIsBehindTarget() and (ccrPHB("Omen of Clarity") or energyregen >= 15)) or ccrPHB("Berserk")) then ccrCastAttack("Shred") return end
			if SCA("Mangle") then ccrCastAttack("Mangle") return end
		end
		if SpellCDDuration("Tiger's Fury") <= 3 then
			if SCA("Ravage") and ccrPHB("Prowl") and ccrPlayerIsBehindTarget() then ccrCastAttack("Ravage") return end
			if SCA("Rake") and ((currake()*(raketicksremaining()+1)-rakecurdmg()*raketicksremaining()) > mangledmg()) then ccrCastAttack("Rake") return end
			if SCA("Shred") and ((ccrPlayerIsBehindTarget() and (ccrPHB("Omen of Clarity") or energyregen >= 15)) or ccrPHB("Berserk")) then ccrCastAttack("Shred") return end
			if SCA("Mangle") then ccrCastAttack("Mangle") return end
		end
		if ((100 - UnitPower("player")) / energyregen) <= 1.0 then
			if SCA("Ravage") and ccrPHB("Prowl") and ccrPlayerIsBehindTarget() then ccrCastAttack("Ravage") return end
			if SCA("Rake") and ((currake()*(raketicksremaining()+1)-rakecurdmg()*raketicksremaining()) > mangledmg()) then ccrCastAttack("Rake") return end
			if SCA("Shred") and ((ccrPlayerIsBehindTarget() and (ccrPHB("Omen of Clarity") or energyregen >= 15)) or ccrPHB("Berserk")) then ccrCastAttack("Shred") return end
			if SCA("Mangle") then ccrCastAttack("Mangle") return end
		end
	end
end

-- function currip()
-- 	this = math.floor(113 + 320 * ccrPoints() * CurMastery() + 0.0484 * ccrPoints() * UnitAttackPower("player") * CurMastery())*8
-- 	return this
-- end

function ripcurdmg()
	-- if x then x:Target() end
	for i = 1, 40 do
	   local name, _, _, _, _, _, _, caster = UnitDebuff("target", i)
	   if name == "Rip" and caster == "player" then
	      tRip = i
	      break
	   end
	end
	if select(8, UnitDebuff("target", "Rip", "", "PLAYER")) == "player" then
		debuffframe:ClearLines()
		debuffframe:SetUnitDebuff("target", tRip)
	else
		return 0
	end
	-- if x then TargetLastTarget() end
	local text = debuffframeTextLeft2:GetText()
	local match =  string.match(text, '%d+')
	return tonumber(match)
end

function rakecurdmg(x)
	if x then x:Target() end
	for i = 1, 40 do
	   local name, _, _, _, _, _, _, caster = UnitDebuff("target", i)
	   if name == "Rake" and caster == "player" then
	      tRake = i
	      break
	   end
	end 
	if select(8, UnitDebuff("target", "Rake", "", "PLAYER")) == "player" then
		debuffframe:ClearLines()
		debuffframe:SetUnitDebuff("target", tRake)
	else
		return 0
	end
	if x then TargetLastTarget() end
	local text = debuffframeTextLeft2:GetText()
	local match = string.match(text, '%d+')
	return tonumber(match)
end

function currip()
	spellframe:ClearLines()
	spellframe:SetSpellByID(1079)
	local text = spellframeTextLeft5:GetText()
	local match = string.match(text, '%d+,%d+', 267)
	local conversion = string.gsub(match, ",", "")
	return (floor(conversion/6.68))
end

function currake()
	spellframe:ClearLines()
	spellframe:SetSpellByID(1822)
	local text = spellframeTextLeft5:GetText()
	local match = string.match(text, '%d+,%d+', 50)
	local conversion = string.gsub(match, ",","")
	return(floor(conversion/5))
end

function raketicksremaining()
	local name, _, _, _, _, _, expires, caster = UnitDebuff("target", "Rake", "", "PLAYER")
	if name == "Rake" and caster == "player" then
		return ceil((expires-GetTime())/3)
	else
		return 0
	end
end

function mangledmg()
	local min, max = UnitDamage("player")
	local avg = select(7, UnitDamage("player"))*390+(((min+max)/2)/2*5)
	return avg
end

function FaerieFireCheck()
	for i = 1, GetTotalObjects(TYPE_UNIT) do
		ObjectCurrent, name, expires, AgonyDuration = nil
		ObjectCurrent = GetObjectListEntry(i)
		if not ObjectCurrent:GetAura("Misery, Sorrow, and Gloom") and not ObjectCurrent:GetAura("Mark of Anguish") and not ObjectCurrent:GetAura("Dark Meditation") then
			name, _, _, count = ObjectCurrent:GetAura("Weakened Armor")
			if ObjectCurrent:GetHealth() > 0 and ObjectCurrent:GetDistance() <= 8 and ObjectCurrent:InLineOfSight() and Player:CanAttack(ObjectCurrent) and ObjectCurrent:GetCreatureInfo() ~= "Critter" and ObjectCurrent:GetCreatureInfo() ~= "Wild Pet" and (not name or count < 3) then ObjectCurrent:CastSpellByName("Faerie Fire") return end
		end
	end
end

-- math.floor(113+320*5*1.488853866311+0.0484*5*41645*1.488853866311)*8

-- math.floor(113+320*CP*1.GetMasteryEffect()+0.0484*CP*AP*1.GetMasteryEffect())*8

-- function GetNearbyTargets()
-- 	local results = {}
-- 	for index = 1, GetTotalObjects() do
-- 		local object = GetObjectListEntry(index)

-- 		if object:GetType() == TYPE_UNIT and not object:IsDead() and object:GetDistance() <= 5 and Player:CanAttack(object) then
-- 			table.insert(results, object)
-- 		end
-- 	end
-- 	return results
-- end

-- function GetNearbyUndottedTargets()
-- 	local targets = GetNearbyTargets()
-- 	local results = {}
-- 	for index, target in ipairs(targets) do
-- 		target:Target()
-- 		local name, _, _, _, _, duration, expires, caster = UnitDebuff("target", "Rake")
-- 		if not name then
-- 			table.insert(results, target)
-- 		end
-- 		if name and not caster == "player" then
-- 			table.insert(results, target)
-- 		end
-- 		if name and expires-GetTime() < 3 then
-- 			table.insert(results, target)
-- 		end
-- 		if name and currake() > rakecurdmg(target) then
-- 			table.insert(results, target)
-- 		end
-- 	end
-- 	return results
-- end

-- function feralDotNearbyTarget()
-- 	-- Dot a nearby target.
-- 	local targets = GetNearbyUndottedTargets()
-- 	local target = targets[1]
-- 	if target and Player:IsInCombat() and not Player:IsMounted() then
-- 		target:CastSpellByName("Rake")
-- 	end
-- end